﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _00_测试代码
{
    public class Program
    {
        static void Main(string[] args)
        {
            //提示用户输入两个数字
            Console.WriteLine("请输入第一个数字:");
            int num1 = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("请输入第二个数字:");
            int num2 = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("请输入运算符:");
            string oper = Console.ReadLine();

            int result = Operation(num1, num2, oper);

            Console.WriteLine("结果是：" + result);

            Console.ReadKey();
        }

        public static int Operation(int a, int b, string oper)
        {
            int result = 0;
            switch (oper)
            {
                case "+":
                    result = a + b;
                    break;
                case "-":
                    result = a - b;
                    break;
                case "*":
                    result = a * b;
                    break;
                case "/":
                    result = a / b;
                    break;
                default:
                    break;
            }
            return result;
        }

    }
}
